package com.example.rk.controller;

import com.example.rk.common.MyPageInfo;
import com.example.rk.common.SessionParameter;
import com.example.rk.entity.*;
import com.example.rk.service.WordCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/count")
public class WordCountController {
    @Autowired
    @Resource
    private WordCountService service;
    @RequestMapping("/count1")
    @ResponseBody
    public List<WordCount> count1() {

        return service.count1();
    }
    @RequestMapping("/count2")
    @ResponseBody
    public List<WordCount> count2() {
        return service.count2();
    }
    @RequestMapping("/count3")
    @ResponseBody
    public List<WordCount> count3() {

        return service.count3();
    }
    @RequestMapping("/count5")
    @ResponseBody
    public List<WordCount> count5() {

        return service.count5();
    }
    @RequestMapping("/count4")
    @ResponseBody
    public List<WordCount> count4() {
        return service.count4();
    }
    @RequestMapping("/flume")
    @ResponseBody
    public String flume(Contract contract,HttpServletRequest request) throws InterruptedException, IOException, ClassNotFoundException {
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        String format = dateFormat.format(new Date());
//        String outputPath="D:\\A\\shuju\\rk\\src\\main\\resources\\flume"+format;
//        File fileStoePAth = new File(outputPath);
//        if(!fileStoePAth.exists()){

        return service.flume1();
        }

}

